/*
 * $Id: InetSocket.h,v 1.11 2006-02-07 06:02:35 bacon Exp $
 */

#ifndef _XPP_NET_INETSOCKET_CLASS_
#define _XPP_NET_INETSOCKET_CLASS_

#include <xpp/net/Socket.h>
#include <xpp/net/InetAddress.h>
#include <xpp/net/EtherAddress.h>
#include <xpp/net/Bindable.h>

namespace xpp
{
	namespace net
	{

		class InetSocket: public Socket, public Bindable
		{
		public:
			InetSocket::InetSocket (int type);

			virtual int open (Handle Handle);
			virtual int open (Handle Handle, const Address& target);
			virtual int open (const Address& target);

			virtual int bind ();
			virtual int bind (const Address& target);

			int getAddress (InetAddress* address);
			int getPeerAddress (InetAddress* address);

#ifndef _WIN32
			int getIfceIndex (const xp_char_t* name);
			int getIfceName (int index, xp_char_t* buf, xp_size_t size);

			int getIfceEtherAddress (
				const xp_char_t* name, EtherAddress* addr);

			int getIfceInetAddress (
				const xp_char_t* name, InetAddress* addr);
			int getIfceNetmask (
				const xp_char_t* name, InetAddress* addr);
			int getIfceBroadcast (
				const xp_char_t* name, InetAddress* addr);
#endif

		protected:
			InetAddress target;

#ifndef _WIN32
			int get_ifce_address (
				const xp_char_t* name, int cmd, InetAddress* addr);
#endif
		};

	}
}

#endif
